home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / tcl / tclInt.h < prev    next >
C/C++ Source or Header  |  1993-02-14  |  32KB  |  817 lines

  1. /*
  2.  * tclInt.h --
  3.  *
  4.  *    Declarations of things used internally by the Tcl interpreter.
  5.  *
  6.  * Copyright 1987-1991 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  */
  16.  
  17. #ifndef _TCLINT
  18. #define _TCLINT
  19.  
  20. /*
  21.  * Common include files needed by most of the Tcl source files are
  22.  * included here, so that system-dependent personalizations for the
  23.  * include files only have to be made in once place.  This results
  24.  * in a few extra includes, but greater modularity.  The order of
  25.  * the three groups of #includes is important.  For example, stdio.h
  26.  * is needed by tcl.h, and the _ANSI_ARGS_ declaration in tcl.h is
  27.  * needed by stdlib.h in some configurations.
  28.  */
  29.  
  30. #include <stdio.h>
  31.  
  32. #ifndef _TCL
  33. #include "tcl.h"
  34. #endif
  35. #ifndef _TCLHASH
  36. #include "tclHash.h"
  37. #endif
  38. #ifndef _REGEXP
  39. #include "regexp.h"
  40. #endif
  41.  
  42. #include <ctype.h>
  43. #include <stdlib.h>
  44. #include <string.h>
  45. #include <varargs.h>
  46.  
  47. /*
  48.  * At present (12/91) not all stdlib.h implementations declare strtod.
  49.  * The declaration below is here to ensure that it's declared, so that
  50.  * the compiler won't take the default approach of assuming it returns
  51.  * an int.  There's no ANSI prototype for it because there would end
  52.  * up being too many conflicts with slightly-different prototypes.
  53.  */
  54.  
  55. extern double strtod();
  56.  
  57. /*
  58.  *----------------------------------------------------------------
  59.  * Data structures related to variables.   These are used primarily
  60.  * in tclVar.c
  61.  *----------------------------------------------------------------
  62.  */
  63.  
  64. /*
  65.  * The following structure defines a variable trace, which is used to
  66.  * invoke a specific C procedure whenever certain operations are performed
  67.  * on a variable.
  68.  */
  69.  
  70. typedef struct VarTrace {
  71.     Tcl_VarTraceProc *traceProc;/* Procedure to call when operations given
  72.                  * by flags are performed on variable. */
  73.     ClientData clientData;    /* Argument to pass to proc. */
  74.     int flags;            /* What events the trace procedure is
  75.                  * interested in:  OR-ed combination of
  76.                  * TCL_TRACE_READS, TCL_TRACE_WRITES, and
  77.                  * TCL_TRACE_UNSETS. */
  78.     struct VarTrace *nextPtr;    /* Next in list of traces associated with
  79.                  * a particular variable. */
  80. } VarTrace;
  81.  
  82. /*
  83.  * When a variable trace is active (i.e. its associated procedure is
  84.  * executing), one of the following structures is linked into a list
  85.  * associated with the variable's interpreter.  The information in
  86.  * the structure is needed in order for Tcl to behave reasonably
  87.  * if traces are deleted while traces are active.
  88.  */
  89.  
  90. typedef struct ActiveVarTrace {
  91.     struct ActiveVarTrace *nextPtr;
  92.                 /* Next in list of all active variable
  93.                  * traces for the interpreter, or NULL
  94.                  * if no more. */
  95.     VarTrace *nextTracePtr;    /* Next trace to check after current
  96.                  * trace procedure returns;  if this
  97.                  * trace gets deleted, must update pointer
  98.                  * to avoid using free'd memory. */
  99. } ActiveVarTrace;
  100.  
  101. /*
  102.  * The following structure describes an enumerative search in progress on
  103.  * an array variable;  this are invoked with options to the "array"
  104.  * command.
  105.  */
  106.  
  107. typedef struct ArraySearch {
  108.     int id;            /* Integer id used to distinguish among
  109.                  * multiple concurrent searches for the
  110.                  * same array. */
  111.     struct Var *varPtr;        /* Pointer to array variable that's being
  112.                  * searched. */
  113.     Tcl_HashSearch search;    /* Info kept by the hash module about
  114.                  * progress through the array. */
  115.     Tcl_HashEntry *nextEntry;    /* Non-null means this is the next element
  116.                  * to be enumerated (it's leftover from
  117.                  * the Tcl_FirstHashEntry call or from
  118.                  * an "array anymore" command).  NULL
  119.                  * means must call Tcl_NextHashEntry
  120.                  * to get value to return. */
  121.     struct ArraySearch *nextPtr;/* Next in list of all active searches
  122.                  * for this variable, or NULL if this is
  123.                  * the last one. */
  124. } ArraySearch;
  125.  
  126. /*
  127.  * The structure below defines a variable, which associates a string name
  128.  * with a string value.  Pointers to these structures are kept as the
  129.  * values of hash table entries, and the name of each variable is stored
  130.  * in the hash entry.
  131.  */
  132.  
  133. typedef struct Var {
  134.     int valueLength;        /* Holds the number of non-null bytes
  135.                  * actually occupied by the variable's
  136.                  * current value in value.string (extra
  137.                  * space is sometimes left for expansion).
  138.                  * For array and global variables this is
  139.                  * meaningless. */
  140.     int valueSpace;        /* Total number of bytes of space allocated
  141.                  * at value. */
  142.     int upvarUses;        /* Counts number of times variable is
  143.                  * is referenced via global or upvar variables
  144.                  * (i.e. how many variables have "upvarPtr"
  145.                  * pointing to this variable).  Variable
  146.                  * can't be deleted until this count reaches
  147.                  * 0. */
  148.     VarTrace *tracePtr;        /* First in list of all traces set for this
  149.                  * variable. */
  150.     ArraySearch *searchPtr;    /* First in list of all searches active
  151.                  * for this variable, or NULL if none. */
  152.     int flags;            /* Miscellaneous bits of information about
  153.                  * variable.  See below for definitions. */
  154.     union {
  155.     char string[4];        /* String value of variable.  The actual
  156.                  * length of this field is given by the
  157.                  * valueSpace field above. */
  158.     Tcl_HashTable *tablePtr;/* For array variables, this points to
  159.                  * information about the hash table used
  160.                  * to implement the associative array. 
  161.                  * Points to malloc-ed data. */
  162.     Tcl_HashEntry *upvarPtr;
  163.                 /* If this is a global variable being
  164.                  * referred to in a procedure, or a variable
  165.                  * created by "upvar", this field points to
  166.                  * the hash table entry for the higher-level
  167.                  * variable. */
  168.     } value;            /* MUST BE LAST FIELD IN STRUCTURE!!! */
  169. } Var;
  170.  
  171. /*
  172.  * Flag bits for variables:
  173.  *
  174.  * VAR_ARRAY    -        1 means this is an array variable rather
  175.  *                than a scalar variable.
  176.  * VAR_UPVAR -             1 means this variable just contains a
  177.  *                pointer to another variable that has the
  178.  *                real value.  Variables like this come
  179.  *                about through the "upvar" and "global"
  180.  *                commands.
  181.  * VAR_UNDEFINED -        1 means that the variable is currently
  182.  *                undefined.  Undefined variables usually
  183.  *                go away completely, but if an undefined
  184.  *                variable has a trace on it, or if it is
  185.  *                a global variable being used by a procedure,
  186.  *                then it stays around even when undefined.
  187.  * VAR_ELEMENT_ACTIVE -        Used only in array variables;  1 means that
  188.  *                an element of the array is currently being
  189.  *                manipulated in some way, so that it isn't
  190.  *                safe to delete the whole array.
  191.  * VAR_TRACE_ACTIVE -        1 means that trace processing is currently
  192.  *                underway for a read or write access, so
  193.  *                new read or write accesses should not cause
  194.  *                trace procedures to be called and the
  195.  *                variable can't be deleted.
  196.  */
  197.  
  198. #define VAR_ARRAY        1
  199. #define VAR_UPVAR        2
  200. #define VAR_UNDEFINED        4
  201. #define VAR_ELEMENT_ACTIVE    0x10
  202. #define VAR_TRACE_ACTIVE    0x20
  203. #define VAR_SEARCHES_POSSIBLE    0x40
  204.  
  205. /*
  206.  *----------------------------------------------------------------
  207.  * Data structures related to procedures.   These are used primarily
  208.  * in tclProc.c
  209.  *----------------------------------------------------------------
  210.  */
  211.  
  212. /*
  213.  * The structure below defines an argument to a procedure, which
  214.  * consists of a name and an (optional) default value.
  215.  */
  216.  
  217. typedef struct Arg {
  218.     struct Arg *nextPtr;    /* Next argument for this procedure,
  219.                  * or NULL if this is the last argument. */
  220.     char *defValue;        /* Pointer to arg's default value, or NULL
  221.                  * if no default value. */
  222.     char name[4];        /* Name of argument starts here.  The name
  223.                  * is followed by space for the default,
  224.                  * if there is one.  The actual size of this
  225.                  * field will be as large as necessary to
  226.                  * hold both name and default value.  THIS
  227.                  * MUST BE THE LAST FIELD IN THE STRUCTURE!! */
  228. } Arg;
  229.  
  230. /*
  231.  * The structure below defines a command procedure, which consists of
  232.  * a collection of Tcl commands plus information about arguments and
  233.  * variables.
  234.  */
  235.  
  236. typedef struct Proc {
  237.     struct Interp *iPtr;    /* Interpreter for which this command
  238.                  * is defined. */
  239.     char *command;        /* Command that constitutes the body of
  240.                  * the procedure (dynamically allocated). */
  241.     Arg *argPtr;        /* Pointer to first of procedure's formal
  242.                  * arguments, or NULL if none. */
  243. } Proc;
  244.  
  245. /*
  246.  * The structure below defines a command trace.  This is used to allow Tcl
  247.  * clients to find out whenever a command is about to be executed.
  248.  */
  249.  
  250. typedef struct Trace {
  251.     int level;            /* Only trace commands at nesting level
  252.                  * less than or equal to this. */
  253.     Tcl_CmdTraceProc *proc;    /* Procedure to call to trace command. */
  254.     ClientData clientData;    /* Arbitrary value to pass to proc. */
  255.     struct Trace *nextPtr;    /* Next in list of traces for this interp. */
  256. } Trace;
  257.  
  258. /*
  259.  * The structure below defines a frame, which is a procedure invocation.
  260.  * These structures exist only while procedures are being executed, and
  261.  * provide a sort of call stack.
  262.  */
  263.  
  264. typedef struct CallFrame {
  265.     Tcl_HashTable varTable;    /* Hash table containing all of procedure's
  266.                  * local variables. */
  267.     int level;            /* Level of this procedure, for "uplevel"
  268.                  * purposes (i.e. corresponds to nesting of
  269.                  * callerVarPtr's, not callerPtr's).  1 means
  270.                  * outer-most procedure, 0 means top-level. */
  271.     int argc;            /* This and argv below describe name and
  272.                  * arguments for this procedure invocation. */
  273.     char **argv;        /* Array of arguments. */
  274.     struct CallFrame *callerPtr;
  275.                 /* Value of interp->framePtr when this
  276.                  * procedure was invoked (i.e. next in
  277.                  * stack of all active procedures). */
  278.     struct CallFrame *callerVarPtr;
  279.                 /* Value of interp->varFramePtr when this
  280.                  * procedure was invoked (i.e. determines
  281.                  * variable scoping within caller;  same
  282.                  * as callerPtr unless an "uplevel" command
  283.                  * or something equivalent was active in
  284.                  * the caller). */
  285. } CallFrame;
  286.  
  287. /*
  288.  * The structure below defines one history event (a previously-executed
  289.  * command that can be re-executed in whole or in part).
  290.  */
  291.  
  292. typedef struct {
  293.     char *command;        /* String containing previously-executed
  294.                  * command. */
  295.     int bytesAvl;        /* Total # of bytes available at *event (not
  296.                  * all are necessarily in use now). */
  297. } HistoryEvent;
  298.  
  299. /*
  300.  *----------------------------------------------------------------
  301.  * Data structures related to history.   These are used primarily
  302.  * in tclHistory.c
  303.  *----------------------------------------------------------------
  304.  */
  305.  
  306. /*
  307.  * The structure below defines a pending revision to the most recent
  308.  * history event.  Changes are linked together into a list and applied
  309.  * during the next call to Tcl_RecordHistory.  See the comments at the
  310.  * beginning of tclHistory.c for information on revisions.
  311.  */
  312.  
  313. typedef struct HistoryRev {
  314.     int firstIndex;        /* Index of the first byte to replace in
  315.                  * current history event. */
  316.     int lastIndex;        /* Index of last byte to replace in
  317.                  * current history event. */
  318.     int newSize;        /* Number of bytes in newBytes. */
  319.     char *newBytes;        /* Replacement for the range given by
  320.                  * firstIndex and lastIndex. */
  321.     struct HistoryRev *nextPtr;    /* Next in chain of revisions to apply, or
  322.                  * NULL for end of list. */
  323. } HistoryRev;
  324.  
  325. /*
  326.  *----------------------------------------------------------------
  327.  * Data structures related to files.  These are used primarily in
  328.  * tclUnixUtil.c and tclUnixAZ.c.
  329.  *----------------------------------------------------------------
  330.  */
  331.  
  332. /*
  333.  * The data structure below defines an open file (or connection to
  334.  * a process pipeline) as returned by the "open" command.
  335.  */
  336.  
  337. typedef struct OpenFile {
  338.     FILE *f;            /* Stdio file to use for reading and/or
  339.                  * writing. */
  340.     FILE *f2;            /* Normally NULL.  In the special case of
  341.                  * a command pipeline with pipes for both
  342.                  * input and output, this is a stdio file
  343.                  * to use for writing to the pipeline. */
  344.     int readable;        /* Non-zero means file may be read. */
  345.     int writable;        /* Non-zero means file may be written. */
  346.     int numPids;        /* If this is a connection to a process
  347.                  * pipeline, gives number of processes
  348.                  * in pidPtr array below;  otherwise it
  349.                  * is 0. */
  350.     int *pidPtr;        /* Pointer to malloc-ed array of child
  351.                  * process ids (numPids of them), or NULL
  352.                  * if this isn't a connection to a process
  353.                  * pipeline. */
  354.     int errorId;        /* File id of file that receives error
  355.                  * output from pipeline.  -1 means not
  356.                  * used (i.e. this is a normal file). */
  357. } OpenFile;
  358.  
  359. /*
  360.  *----------------------------------------------------------------
  361.  * This structure defines an interpreter, which is a collection of
  362.  * commands plus other state information related to interpreting
  363.  * commands, such as variable storage.  Primary responsibility for
  364.  * this data structure is in tclBasic.c, but almost every Tcl
  365.  * source file uses something in here.
  366.  *----------------------------------------------------------------
  367.  */
  368.  
  369. typedef struct Command {
  370.     Tcl_CmdProc *proc;        /* Procedure to process command. */
  371.     ClientData clientData;    /* Arbitrary value to pass to proc. */
  372.     Tcl_CmdDeleteProc *deleteProc;
  373.                 /* Procedure to invoke when deleting
  374.                  * command. */
  375. } Command;
  376.  
  377. #define CMD_SIZE(nameLength) ((unsigned) sizeof(Command) + nameLength - 3)
  378.  
  379. typedef struct Interp {
  380.  
  381.     /*
  382.      * Note:  the first three fields must match exactly the fields in
  383.      * a Tcl_Interp struct (see tcl.h).  If you change one, be sure to
  384.      * change the other.
  385.      */
  386.  
  387.     char *result;        /* Points to result returned by last
  388.                  * command. */
  389.     Tcl_FreeProc *freeProc;    /* Zero means result is statically allocated.
  390.                  * If non-zero, gives address of procedure
  391.                  * to invoke to free the result.  Must be
  392.                  * freed by Tcl_Eval before executing next
  393.                  * command. */
  394.     int errorLine;        /* When TCL_ERROR is returned, this gives
  395.                  * the line number within the command where
  396.                  * the error occurred (1 means first line). */
  397.     Tcl_HashTable commandTable;    /* Contains all of the commands currently
  398.                  * registered in this interpreter.  Indexed
  399.                  * by strings; values have type (Command *). */
  400.  
  401.     /*
  402.      * Information related to procedures and variables.  See tclProc.c
  403.      * and tclvar.c for usage.
  404.      */
  405.  
  406.     Tcl_HashTable globalTable;    /* Contains all global variables for
  407.                  * interpreter. */
  408.     int numLevels;        /* Keeps track of how many nested calls to
  409.                  * Tcl_Eval are in progress for this
  410.                  * interpreter.  It's used to delay deletion
  411.                  * of the table until all Tcl_Eval invocations
  412.                  * are completed. */
  413.     CallFrame *framePtr;    /* Points to top-most in stack of all nested
  414.                  * procedure invocations.  NULL means there
  415.                  * are no active procedures. */
  416.     CallFrame *varFramePtr;    /* Points to the call frame whose variables
  417.                  * are currently in use (same as framePtr
  418.                  * unless an "uplevel" command is being
  419.                  * executed).  NULL means no procedure is
  420.                  * active or "uplevel 0" is being exec'ed. */
  421.     ActiveVarTrace *activeTracePtr;
  422.                 /* First in list of active traces for interp,
  423.                  * or NULL if no active traces. */
  424.  
  425.     /*
  426.      * Information related to history:
  427.      */
  428.  
  429.     int numEvents;        /* Number of previously-executed commands
  430.                  * to retain. */
  431.     HistoryEvent *events;    /* Array containing numEvents entries
  432.                  * (dynamically allocated). */
  433.     int curEvent;        /* Index into events of place where current
  434.                  * (or most recent) command is recorded. */
  435.     int curEventNum;        /* Event number associated with the slot
  436.                  * given by curEvent. */
  437.     HistoryRev *revPtr;        /* First in list of pending revisions. */
  438.     char *historyFirst;        /* First char. of current command executed
  439.                  * from history module or NULL if none. */
  440.     int revDisables;        /* 0 means history revision OK;  > 0 gives
  441.                  * a count of number of times revision has
  442.                  * been disabled. */
  443.     char *evalFirst;        /* If TCL_RECORD_BOUNDS flag set, Tcl_Eval
  444.                  * sets this field to point to the first
  445.                  * char. of text from which the current
  446.                  * command came.  Otherwise Tcl_Eval sets
  447.                  * this to NULL. */
  448.     char *evalLast;        /* Similar to evalFirst, except points to
  449.                  * last character of current command. */
  450.  
  451.     /*
  452.      * Information used by Tcl_AppendResult to keep track of partial
  453.      * results.  See Tcl_AppendResult code for details.
  454.      */
  455.  
  456.     char *appendResult;        /* Storage space for results generated
  457.                  * by Tcl_AppendResult.  Malloc-ed.  NULL
  458.                  * means not yet allocated. */
  459.     int appendAvl;        /* Total amount of space available at
  460.                  * partialResult. */
  461.     int appendUsed;        /* Number of non-null bytes currently
  462.                  * stored at partialResult. */
  463.  
  464.     /*
  465.      * Information related to files.  See tclUnixAZ.c and tclUnixUtil.c
  466.      * for details.
  467.      */
  468.  
  469.     int numFiles;        /* Number of entries in filePtrArray
  470.                  * below.  0 means array hasn't been
  471.                  * created yet. */
  472.     OpenFile **filePtrArray;    /* Pointer to malloc-ed array of pointers
  473.                  * to information about open files.  Entry
  474.                  * N corresponds to the file with fileno N.
  475.                  * If an entry is NULL then the corresponding
  476.                  * file isn't open.  If filePtrArray is NULL
  477.                  * it means no files have been used, so even
  478.                  * stdin/stdout/stderr entries haven't been
  479.                  * setup yet. */
  480.     /*
  481.      * A cache of compiled regular expressions.  See TclCompileRegexp
  482.      * in tclUtil.c for details.
  483.      */
  484.  
  485. #define NUM_REGEXPS 5
  486.     char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled
  487.                  * regular expression patterns.  NULL
  488.                  * means that this slot isn't used.
  489.                  * Malloc-ed. */
  490.     int patLengths[NUM_REGEXPS];/* Number of non-null characters in
  491.                  * corresponding entry in patterns.
  492.                  * -1 means entry isn't used. */
  493.     regexp *regexps[NUM_REGEXPS];
  494.                 /* Compiled forms of above strings.  Also
  495.                  * malloc-ed, or NULL if not in use yet. */
  496.  
  497.  
  498.     /*
  499.      * Miscellaneous information:
  500.      */
  501.  
  502.     int cmdCount;        /* Total number of times a command procedure
  503.                  * has been called for this interpreter. */
  504.     int noEval;            /* Non-zero means no commands should actually
  505.                  * be executed:  just parse only.  Used in
  506.                  * expressions when the result is already
  507.                  * determined. */
  508.     char *scriptFile;        /* NULL means there is no nested source
  509.                  * command active;  otherwise this points to
  510.                  * the name of the file being sourced (it's
  511.                  * not malloc-ed:  it points to an argument
  512.                  * to Tcl_EvalFile. */
  513.     int flags;            /* Various flag bits.  See below. */
  514.     Trace *tracePtr;        /* List of traces for this interpreter. */
  515.     char resultSpace[TCL_RESULT_SIZE+1];
  516.                 /* Static space for storing small results. */
  517. } Interp;
  518.  
  519. /*
  520.  * Flag bits for Interp structures:
  521.  *
  522.  * DELETED:        Non-zero means the interpreter has been deleted:
  523.  *            don't process any more commands for it, and destroy
  524.  *            the structure as soon as all nested invocations of
  525.  *            Tcl_Eval are done.
  526.  * ERR_IN_PROGRESS:    Non-zero means an error unwind is already in progress.
  527.  *            Zero means a command proc has been invoked since last
  528.  *            error occured.
  529.  * ERR_ALREADY_LOGGED:    Non-zero means information has already been logged
  530.  *            in $errorInfo for the current Tcl_Eval instance,
  531.  *            so Tcl_Eval needn't log it (used to implement the
  532.  *            "error message log" command).
  533.  * ERROR_CODE_SET:    Non-zero means that Tcl_SetErrorCode has been
  534.  *            called to record information for the current
  535.  *            error.  Zero means Tcl_Eval must clear the
  536.  *            errorCode variable if an error is returned.
  537.  */
  538.  
  539. #define DELETED            1
  540. #define ERR_IN_PROGRESS        2
  541. #define ERR_ALREADY_LOGGED    4
  542. #define ERROR_CODE_SET        8
  543.  
  544. /*
  545.  *----------------------------------------------------------------
  546.  * Data structures related to command parsing.   These are used in
  547.  * tclParse.c and its clients.
  548.  *----------------------------------------------------------------
  549.  */
  550.  
  551. /*
  552.  * The following data structure is used by various parsing procedures
  553.  * to hold information about where to store the results of parsing
  554.  * (e.g. the substituted contents of a quoted argument, or the result
  555.  * of a nested command).  At any given time, the space available
  556.  * for output is fixed, but a procedure may be called to expand the
  557.  * space available if the current space runs out.
  558.  */
  559.  
  560. typedef struct ParseValue {
  561.     char *buffer;        /* Address of first character in
  562.                  * output buffer. */
  563.     char *next;            /* Place to store next character in
  564.                  * output buffer. */
  565.     char *end;            /* Address of the last usable character
  566.                  * in the buffer. */
  567.     void (*expandProc) _ANSI_ARGS_((struct ParseValue *pvPtr, int needed));
  568.                 /* Procedure to call when space runs out;
  569.                  * it will make more space. */
  570.     ClientData clientData;    /* Arbitrary information for use of
  571.                  * expandProc. */
  572. } ParseValue;
  573.  
  574. /*
  575.  * A table used to classify input characters to assist in parsing
  576.  * Tcl commands.  The table should be indexed with a signed character
  577.  * using the CHAR_TYPE macro.  The character may have a negative
  578.  * value.
  579.  */
  580.  
  581. extern char tclTypeTable[];
  582. #define CHAR_TYPE(c) (tclTypeTable+128)[c]
  583.  
  584. /*
  585.  * Possible values returned by CHAR_TYPE:
  586.  *
  587.  * TCL_NORMAL -        All characters that don't have special significance
  588.  *            to the Tcl language.
  589.  * TCL_SPACE -        Character is space, tab, or return.
  590.  * TCL_COMMAND_END -    Character is newline or null or semicolon or
  591.  *            close-bracket.
  592.  * TCL_QUOTE -        Character is a double-quote.
  593.  * TCL_OPEN_BRACKET -    Character is a "[".
  594.  * TCL_OPEN_BRACE -    Character is a "{".
  595.  * TCL_CLOSE_BRACE -    Character is a "}".
  596.  * TCL_BACKSLASH -    Character is a "\".
  597.  * TCL_DOLLAR -        Character is a "$".
  598.  */
  599.  
  600. #define TCL_NORMAL        0
  601. #define TCL_SPACE        1
  602. #define TCL_COMMAND_END        2
  603. #define TCL_QUOTE        3
  604. #define TCL_OPEN_BRACKET    4
  605. #define TCL_OPEN_BRACE        5
  606. #define TCL_CLOSE_BRACE        6
  607. #define TCL_BACKSLASH        7
  608. #define TCL_DOLLAR        8
  609.  
  610. /*
  611.  * Additional flags passed to Tcl_Eval.  See tcl.h for other flags to
  612.  * Tcl_Eval;  these ones are only used internally by Tcl.
  613.  *
  614.  * TCL_RECORD_BOUNDS    Tells Tcl_Eval to record information in the
  615.  *            evalFirst and evalLast fields for each command
  616.  *            executed directly from the string (top-level
  617.  *            commands and those from command substitution).
  618.  */
  619.  
  620. #define TCL_RECORD_BOUNDS    0x100
  621.  
  622. /*
  623.  * Maximum number of levels of nesting permitted in Tcl commands.
  624.  */
  625.  
  626. #define MAX_NESTING_DEPTH    100
  627.  
  628. /*
  629.  * Variables shared among Tcl modules but not used by the outside
  630.  * world:
  631.  */
  632.  
  633. extern char *        tclRegexpError;
  634.  
  635. /*
  636.  *----------------------------------------------------------------
  637.  * Procedures shared among Tcl modules but not used by the outside
  638.  * world:
  639.  *----------------------------------------------------------------
  640.  */
  641.  
  642. extern void        panic();
  643. extern regexp *        TclCompileRegexp _ANSI_ARGS_((Tcl_Interp *interp,
  644.                 char *string));
  645. extern void        TclCopyAndCollapse _ANSI_ARGS_((int count, char *src,
  646.                 char *dst));
  647. extern void        TclDeleteVars _ANSI_ARGS_((Interp *iPtr,
  648.                 Tcl_HashTable *tablePtr));
  649. extern void        TclExpandParseValue _ANSI_ARGS_((ParseValue *pvPtr,
  650.                 int needed));
  651. extern int        TclFindElement _ANSI_ARGS_((Tcl_Interp *interp,
  652.                 char *list, char **elementPtr, char **nextPtr,
  653.                 int *sizePtr, int *bracePtr));
  654. extern Proc *        TclFindProc _ANSI_ARGS_((Interp *iPtr,
  655.                 char *procName));
  656. extern int        TclGetFrame _ANSI_ARGS_((Tcl_Interp *interp,
  657.                 char *string, CallFrame **framePtrPtr));
  658. extern int        TclGetListIndex _ANSI_ARGS_((Tcl_Interp *interp,
  659.                 char *string, int *indexPtr));
  660. extern int        TclGetOpenFile _ANSI_ARGS_((Tcl_Interp *interp,
  661.                 char *string, OpenFile **filePtrPtr));
  662. extern Proc *        TclIsProc _ANSI_ARGS_((Command *cmdPtr));
  663. extern void        TclMakeFileTable _ANSI_ARGS_((Interp *iPtr,
  664.                 int index));
  665. extern int        TclParseBraces _ANSI_ARGS_((Tcl_Interp *interp,
  666.                 char *string, char **termPtr, ParseValue *pvPtr));
  667. extern int        TclParseNestedCmd _ANSI_ARGS_((Tcl_Interp *interp,
  668.                 char *string, int flags, char **termPtr,
  669.                 ParseValue *pvPtr));
  670. extern int        TclParseQuotes _ANSI_ARGS_((Tcl_Interp *interp,
  671.                 char *string, int termChar, int flags,
  672.                 char **termPtr, ParseValue *pvPtr));
  673. extern int        TclParseWords _ANSI_ARGS_((Tcl_Interp *interp,
  674.                 char *string, int flags, int maxWords,
  675.                 char **termPtr, int *argcPtr, char **argv,
  676.                 ParseValue *pvPtr));
  677. extern void        TclSetupEnv _ANSI_ARGS_((Tcl_Interp *interp));
  678. extern char *        TclWordEnd _ANSI_ARGS_((char *start, int nested));
  679.  
  680. /*
  681.  *----------------------------------------------------------------
  682.  * Command procedures in the generic core:
  683.  *----------------------------------------------------------------
  684.  */
  685.  
  686. extern int    Tcl_AppendCmd _ANSI_ARGS_((ClientData clientData,
  687.             Tcl_Interp *interp, int argc, char **argv));
  688. extern int    Tcl_ArrayCmd _ANSI_ARGS_((ClientData clientData,
  689.             Tcl_Interp *interp, int argc, char **argv));
  690. extern int    Tcl_BreakCmd _ANSI_ARGS_((ClientData clientData,
  691.             Tcl_Interp *interp, int argc, char **argv));
  692. extern int    Tcl_CaseCmd _ANSI_ARGS_((ClientData clientData,
  693.             Tcl_Interp *interp, int argc, char **argv));
  694. extern int    Tcl_CatchCmd _ANSI_ARGS_((ClientData clientData,
  695.             Tcl_Interp *interp, int argc, char **argv));
  696. extern int    Tcl_ConcatCmd _ANSI_ARGS_((ClientData clientData,
  697.             Tcl_Interp *interp, int argc, char **argv));
  698. extern int    Tcl_ContinueCmd _ANSI_ARGS_((ClientData clientData,
  699.             Tcl_Interp *interp, int argc, char **argv));
  700. extern int    Tcl_ErrorCmd _ANSI_ARGS_((ClientData clientData,
  701.             Tcl_Interp *interp, int argc, char **argv));
  702. extern int    Tcl_EvalCmd _ANSI_ARGS_((ClientData clientData,
  703.             Tcl_Interp *interp, int argc, char **argv));
  704. extern int    Tcl_ExprCmd _ANSI_ARGS_((ClientData clientData,
  705.             Tcl_Interp *interp, int argc, char **argv));
  706. extern int    Tcl_ForCmd _ANSI_ARGS_((ClientData clientData,
  707.             Tcl_Interp *interp, int argc, char **argv));
  708. extern int    Tcl_ForeachCmd _ANSI_ARGS_((ClientData clientData,
  709.             Tcl_Interp *interp, int argc, char **argv));
  710. extern int    Tcl_FormatCmd _ANSI_ARGS_((ClientData clientData,
  711.             Tcl_Interp *interp, int argc, char **argv));
  712. extern int    Tcl_GlobalCmd _ANSI_ARGS_((ClientData clientData,
  713.             Tcl_Interp *interp, int argc, char **argv));
  714. extern int    Tcl_HistoryCmd _ANSI_ARGS_((ClientData clientData,
  715.             Tcl_Interp *interp, int argc, char **argv));
  716. extern int    Tcl_IfCmd _ANSI_ARGS_((ClientData clientData,
  717.             Tcl_Interp *interp, int argc, char **argv));
  718. extern int    Tcl_IncrCmd _ANSI_ARGS_((ClientData clientData,
  719.             Tcl_Interp *interp, int argc, char **argv));
  720. extern int    Tcl_InfoCmd _ANSI_ARGS_((ClientData clientData,
  721.             Tcl_Interp *interp, int argc, char **argv));
  722. extern int    Tcl_JoinCmd _ANSI_ARGS_((ClientData clientData,
  723.             Tcl_Interp *interp, int argc, char **argv));
  724. extern int    Tcl_LappendCmd _ANSI_ARGS_((ClientData clientData,
  725.             Tcl_Interp *interp, int argc, char **argv));
  726. extern int    Tcl_LindexCmd _ANSI_ARGS_((ClientData clientData,
  727.             Tcl_Interp *interp, int argc, char **argv));
  728. extern int    Tcl_LinsertCmd _ANSI_ARGS_((ClientData clientData,
  729.             Tcl_Interp *interp, int argc, char **argv));
  730. extern int    Tcl_LlengthCmd _ANSI_ARGS_((ClientData clientData,
  731.             Tcl_Interp *interp, int argc, char **argv));
  732. extern int    Tcl_ListCmd _ANSI_ARGS_((ClientData clientData,
  733.             Tcl_Interp *interp, int argc, char **argv));
  734. extern int    Tcl_LrangeCmd _ANSI_ARGS_((ClientData clientData,
  735.             Tcl_Interp *interp, int argc, char **argv));
  736. extern int    Tcl_LreplaceCmd _ANSI_ARGS_((ClientData clientData,
  737.             Tcl_Interp *interp, int argc, char **argv));
  738. extern int    Tcl_LsearchCmd _ANSI_ARGS_((ClientData clientData,
  739.             Tcl_Interp *interp, int argc, char **argv));
  740. extern int    Tcl_LsortCmd _ANSI_ARGS_((ClientData clientData,
  741.             Tcl_Interp *interp, int argc, char **argv));
  742. extern int    Tcl_ProcCmd _ANSI_ARGS_((ClientData clientData,
  743.             Tcl_Interp *interp, int argc, char **argv));
  744. extern int    Tcl_RegexpCmd _ANSI_ARGS_((ClientData clientData,
  745.             Tcl_Interp *interp, int argc, char **argv));
  746. extern int    Tcl_RegsubCmd _ANSI_ARGS_((ClientData clientData,
  747.             Tcl_Interp *interp, int argc, char **argv));
  748. extern int    Tcl_RenameCmd _ANSI_ARGS_((ClientData clientData,
  749.             Tcl_Interp *interp, int argc, char **argv));
  750. extern int    Tcl_ReturnCmd _ANSI_ARGS_((ClientData clientData,
  751.             Tcl_Interp *interp, int argc, char **argv));
  752. extern int    Tcl_ScanCmd _ANSI_ARGS_((ClientData clientData,
  753.             Tcl_Interp *interp, int argc, char **argv));
  754. extern int    Tcl_SetCmd _ANSI_ARGS_((ClientData clientData,
  755.             Tcl_Interp *interp, int argc, char **argv));
  756. extern int    Tcl_SplitCmd _ANSI_ARGS_((ClientData clientData,
  757.             Tcl_Interp *interp, int argc, char **argv));
  758. extern int    Tcl_StringCmd _ANSI_ARGS_((ClientData clientData,
  759.             Tcl_Interp *interp, int argc, char **argv));
  760. extern int    Tcl_TraceCmd _ANSI_ARGS_((ClientData clientData,
  761.             Tcl_Interp *interp, int argc, char **argv));
  762. extern int    Tcl_UnsetCmd _ANSI_ARGS_((ClientData clientData,
  763.             Tcl_Interp *interp, int argc, char **argv));
  764. extern int    Tcl_UplevelCmd _ANSI_ARGS_((ClientData clientData,
  765.             Tcl_Interp *interp, int argc, char **argv));
  766. extern int    Tcl_UpvarCmd _ANSI_ARGS_((ClientData clientData,
  767.             Tcl_Interp *interp, int argc, char **argv));
  768. extern int    Tcl_WhileCmd _ANSI_ARGS_((ClientData clientData,
  769.             Tcl_Interp *interp, int argc, char **argv));
  770. extern int    Tcl_Cmd _ANSI_ARGS_((ClientData clientData,
  771.             Tcl_Interp *interp, int argc, char **argv));
  772. extern int    Tcl_Cmd _ANSI_ARGS_((ClientData clientData,
  773.             Tcl_Interp *interp, int argc, char **argv));
  774.  
  775. /*
  776.  *----------------------------------------------------------------
  777.  * Command procedures in the UNIX core:
  778.  *----------------------------------------------------------------
  779.  */
  780.  
  781. extern int    Tcl_CdCmd _ANSI_ARGS_((ClientData clientData,
  782.             Tcl_Interp *interp, int argc, char **argv));
  783. extern int    Tcl_CloseCmd _ANSI_ARGS_((ClientData clientData,
  784.             Tcl_Interp *interp, int argc, char **argv));
  785. extern int    Tcl_EofCmd _ANSI_ARGS_((ClientData clientData,
  786.             Tcl_Interp *interp, int argc, char **argv));
  787. extern int    Tcl_ExecCmd _ANSI_ARGS_((ClientData clientData,
  788.             Tcl_Interp *interp, int argc, char **argv));
  789. extern int    Tcl_ExitCmd _ANSI_ARGS_((ClientData clientData,
  790.             Tcl_Interp *interp, int argc, char **argv));
  791. extern int    Tcl_FileCmd _ANSI_ARGS_((ClientData clientData,
  792.             Tcl_Interp *interp, int argc, char **argv));
  793. extern int    Tcl_FlushCmd _ANSI_ARGS_((ClientData clientData,
  794.             Tcl_Interp *interp, int argc, char **argv));
  795. extern int    Tcl_GetsCmd _ANSI_ARGS_((ClientData clientData,
  796.             Tcl_Interp *interp, int argc, char **argv));
  797. extern int    Tcl_GlobCmd _ANSI_ARGS_((ClientData clientData,
  798.             Tcl_Interp *interp, int argc, char **argv));
  799. extern int    Tcl_OpenCmd _ANSI_ARGS_((ClientData clientData,
  800.             Tcl_Interp *interp, int argc, char **argv));
  801. extern int    Tcl_PutsCmd _ANSI_ARGS_((ClientData clientData,
  802.             Tcl_Interp *interp, int argc, char **argv));
  803. extern int    Tcl_PwdCmd _ANSI_ARGS_((ClientData clientData,
  804.             Tcl_Interp *interp, int argc, char **argv));
  805. extern int    Tcl_ReadCmd _ANSI_ARGS_((ClientData clientData,
  806.             Tcl_Interp *interp, int argc, char **argv));
  807. extern int    Tcl_SeekCmd _ANSI_ARGS_((ClientData clientData,
  808.             Tcl_Interp *interp, int argc, char **argv));
  809. extern int    Tcl_SourceCmd _ANSI_ARGS_((ClientData clientData,
  810.             Tcl_Interp *interp, int argc, char **argv));
  811. extern int    Tcl_TellCmd _ANSI_ARGS_((ClientData clientData,
  812.             Tcl_Interp *interp, int argc, char **argv));
  813. extern int    Tcl_TimeCmd _ANSI_ARGS_((ClientData clientData,
  814.             Tcl_Interp *interp, int argc, char **argv));
  815.  
  816. #endif /* _TCLINT */
  817.